package org.tema1;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AddCityActivity extends Activity{
	
	Button ok;
	Button cancel;
	EditText editor;
	Intent raspuns;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_city);
        
        ok = (Button)findViewById(R.id.ok);
        cancel = (Button)findViewById(R.id.cancel);
        editor = (EditText)findViewById(R.id.editor);
        raspuns = new Intent ();
        
        ok.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				raspuns.putExtra("oras", editor.getText().toString());
				setResult(1, raspuns);
				finish();
			}
        });
        
        cancel.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				setResult(0);
				finish();
			}
        });
	}
}
